<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小红书助手 - 下载页面</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
            color: #333;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        h1 {
            color: #ff2442;
            margin-bottom: 30px;
            text-align: center;
        }
        .release-list {
            list-style: none;
            padding: 0;
        }
        .release-item {
            border: 1px solid #eee;
            margin-bottom: 20px;
            padding: 20px;
            border-radius: 4px;
            transition: all 0.3s ease;
        }
        .release-item:hover {
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        .release-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        .version {
            font-size: 1.2em;
            font-weight: bold;
            color: #ff2442;
        }
        .date {
            color: #666;
            font-size: 0.9em;
        }
        .description {
            margin: 10px 0;
            color: #666;
        }
        .download-btn {
            display: inline-block;
            background-color: #ff2442;
            color: white;
            padding: 10px 20px;
            text-decoration: none;
            border-radius: 4px;
            transition: background-color 0.3s ease;
        }
        .download-btn:hover {
            background-color: #e61e3c;
        }
        .instructions {
            margin-top: 30px;
            padding: 20px;
            background-color: #f8f9fa;
            border-radius: 4px;
        }
        .instructions h2 {
            color: #333;
            margin-top: 0;
        }
        .tips-list {
            list-style: none;
            padding: 0;
            margin-top: 15px;
        }
        .tips-list li {
            position: relative;
            padding-left: 20px;
            margin-bottom: 10px;
            color: #666;
        }
        .tips-list li:before {
            content: "•";
            color: #ff2442;
            position: absolute;
            left: 0;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>小红书助手 - 下载页面</h1>
        
        <div class="release-list" id="releaseList">
            <!-- Releases will be populated here -->
        </div>

        <div class="instructions">
            <h2>安装说明</h2>
            <ol>
                <li>下载最新版本的插件压缩包</li>
                <li>解压下载的文件</li>
                <li>打开Chrome浏览器，进入扩展程序页面（chrome://extensions/）</li>
                <li>开启右上角的"开发者模式"</li>
                <li>点击"加载已解压的扩展程序"</li>
                <li>选择解压后的文件夹即可完成安装</li>
            </ol>
            <h2>重要提示</h2>
            <ul class="tips-list">
                <li>首次使用，需安装对应浏览器插件，暂不支持移动端使用</li>
                <li>下载后，根据提示授予权限，并重新刷新本页面</li>
                <li>如果你从未在你的浏览器上登录过小红书，请先完成登录</li>
                <li>获取笔记时浏览器会自动打开小红书网页，请勿慌张，也无需操作，完成后会自动关闭</li>
                <li>此功能仅在 Chrome 或兼容的浏览器中有效</li>
            </ul>
        </div>
    </div>

    <script>
        // 获取release目录下的release.json文件
        async function fetchReleases() {
            try {
                // 使用相对路径，适应本地开发环境
                const response = await fetch('./release/release.json');
                if (!response.ok) {
                    throw new Error(`HTTP error! status: ${response.status}`);
                }
                const releases = await response.json();
                displayReleases(releases);
            } catch (error) {
                console.error('Error fetching releases:', error);
                // 如果API不可用，显示静态示例
                displayStaticReleases();
            }
        }

        function displayReleases(releases) {
            const releaseList = document.getElementById('releaseList');
            releaseList.innerHTML = releases.map(release => `
                <div class="release-item">
                    <div class="release-header">
                        <span class="version">版本 ${release.version}</span>
                        <span class="date">${release.date}</span>
                    </div>
                    <div class="description">${release.description}</div>
                    <a href="./release/xhs-chrome-plugin-${release.version}.zip" 
                       class="download-btn" 
                       download="xhs-chrome-plugin-${release.version}.zip">下载</a>
                </div>
            `).join('');
        }

        function displayStaticReleases() {
            const releaseList = document.getElementById('releaseList');
            releaseList.innerHTML = `
                <div class="release-item">
                    <div class="release-header">
                        <span class="version">版本 1.0.5.1</span>
                        <span class="date">2024-03-21</span>
                    </div>
                    <div class="description">最新版本发布</div>
                    <a href="./release/xhs-chrome-plugin-1.0.5.1.zip" 
                       class="download-btn" 
                       download="xhs-chrome-plugin-1.0.5.1.zip">下载</a>
                </div>
            `;
        }

        // 页面加载时获取发布列表
        document.addEventListener('DOMContentLoaded', fetchReleases);
    </script>
</body>
</html> 